Skip to content

4.0: shared DeallocTestsCore target (step 1 of the 4.0 plan) - #22

Open
DanielCech wants to merge 1 commit into
dc/feat/v4from
dc/feat/v4-core
Open

DanielCech wants to merge 1 commit into
dc/feat/v4from
dc/feat/v4-core

Conversation

@DanielCech

Copy link
Copy Markdown
Member

Stacked on #21. First step of the 4.0.0 plan: everything from the competitive research and the JustFlip proof of concept ships in 4.0.0, in stacked PRs on dc/feat/v4.

Why

The 4.0 plan adds a second product, DeallocWatcher, that apps link in Debug builds to catch leaks LeakCanary-style. It needs the same hint and report engine as the tests, but apps must never link XCTest or Swift Testing. So the shared parts move into an internal target first.

What changes

  • New target DeallocTestsCore (not a product) with:
    • readable type names (TypeNames)
    • leak hints (LeakHints)
    • the leak report and its message (LeakReport, previously DeallocationTracker.leakMessage)
    • polling (Polling.waitUntil), now shared by the deallocation check and the UIKit lifecycle waits
  • Everything uses Swift's package access, so the public API is unchanged.
  • Two rules for Core, checked in CI:
    • no import XCTest / import Testing, because apps will link it through DeallocWatcher;
    • no classes or actors: Core may end up in both an app and its test bundle, and duplicate Objective-C classes would trigger runtime warnings.
  • New test target DeallocTestsCoreTests (6 tests).

No behaviour change: messages, timing and API are the same.

Tests

  • swift test (default traits and --disable-default-traits): all existing tests plus the 6 Core tests pass.
  • iOS simulator package tests and the DI sample app build pass.

🤖 Generated with Claude Code

Moves the framework-independent parts out of DeallocTests: readable type
names, leak hints, the leak report formatting and polling. Core imports
neither XCTest nor Swift Testing and has no classes, so the upcoming
DeallocWatcher product can share it with apps. CI checks both rules.
No behaviour change.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant